package Twx0429;

import Twx0429.UserListener;

import javax.swing.*;
import java.awt.*;

public class UI {

    public void showLoginUI(){
        JFrame jf = new JFrame();
        jf.setTitle("登录注册界面");
        jf.setSize(400,480);//设置窗口大小
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//关闭当前窗体
        jf.setLayout(new FlowLayout());//流式布局
        jf.setLocation(500,500);//在屏幕上的位置
        jf.setVisible(true);//设置Frame为可见，默认不可见

        String path = "C:\\Users\\文潇\\Desktop\\图片\\1715342650175.jpg";
        ImageIcon icon = new ImageIcon(path);
        JLabel iconJla = new JLabel(icon);
        jf.add(iconJla);

        JLabel nameJla = new JLabel("账号： ");
        jf.add(nameJla);

        JTextField nameIn = new JTextField(30);
        jf.add(nameIn);

        JLabel pwdJla = new JLabel("密码： ");
        jf.add(pwdJla);

        JPasswordField pwdIn = new JPasswordField(30);
        jf.add(pwdIn);

        JButton btnLogin = new JButton("登录");
        JButton btnRegist = new JButton("注册");
        jf.add(btnLogin);
        jf.add(btnRegist);


        jf.setResizable(false);


        UserListener u1 = new UserListener();
        btnLogin.addActionListener(u1);
        btnRegist.addActionListener(u1);

        u1.nameIn2 = nameIn;
        u1.pwdIn2 = pwdIn;

    }
//    public static void main(String[] args){
//        UI ui = new UI();
//        ui.showLoginUI();
//    }

}

